const mutations = {
    addCart(state, info) {
        // console.log(info);
        // let goods =state.cartList.find(item=>item.iid===info.iid)
        // if(goods){
        //     goods.count++
        // }else{
        //     info.count=1
        //     info.checked = true
        //      state.cartList.push(info)
        // }
        let goods = state.cartList.find(item => item.foodName === info.foodName);
        if (goods) {
            goods.count++
        } else {
            info.count = 1
            info.checked = true
            state.cartList.push(info)
        }
    },
    deleteAllCart(state, info) {
        state.cartList = [];
    }
}

export default mutations